package com.xinqi.modules.course.textbook.controller.inner;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.course.textbook.dto.req.CourseCloudTextbookContentQueryDTO;
import com.xinqi.modules.course.textbook.dto.rsp.CourseCloudTextbookContentResultDTO;
import com.xinqi.modules.course.textbook.service.CourseCloudTextbookContentService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 课程模块云课本课堂内容内部控制层
 *
 * @author: wenjie
 * @date: 2023/05/30
 */
@Hidden
@RestController
@RequestMapping("/inner/course-cloud-textbook-content")
@RequiredArgsConstructor
public class CourseCloudTextbookContentInnerController {
    private final CourseCloudTextbookContentService courseCloudTextbookContentService;

    /**
     * 课程模块云课本课堂内容-分页
     */
    @GetMapping("/page")
    public R<PageInfo<CourseCloudTextbookContentResultDTO>> page(Param pageable, CourseCloudTextbookContentQueryDTO dto) {
        PageInfo<CourseCloudTextbookContentResultDTO> page = courseCloudTextbookContentService.page(pageable, dto);
        return R.data(page);
    }

    /**
     * 课程模块云课本课堂内容-详情
     */
    @GetMapping("/{id}")
    public R<CourseCloudTextbookContentResultDTO> findById(@PathVariable("id") Long id) {
        CourseCloudTextbookContentResultDTO dto = courseCloudTextbookContentService.findById(id);
        return R.data(dto);
    }
}
